package com.guigu.aws.demo01;

import java.util.UUID;

import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.regions.Region;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;

/**
 * Hello world!
 *
 */
public class S3CreateApp {

	private static String AWS_ACCESS_KEY = "AWS_ACCESS_KEY";
	private static String AWS_SECRET_KEY = "AWS_SECRET_KEY ";

	// 创建桶
	public static void main(String[] args) {
		// 创建 s3 对象
		AmazonS3 s3 = new AmazonS3Client(new BasicAWSCredentials(AWS_ACCESS_KEY, AWS_SECRET_KEY));
		// 设置区域 ( 我们使用的是宁夏区域 )
		s3.setRegion(Region.getRegion(Regions.CN_NORTHWEST_1));
		// 桶的名字
		String bucketName = "sflfirst" + UUID.randomUUID();
		// 设置 k
		String key = "sflfirst";
		s3.createBucket(bucketName);
		System.out.println("创建成功");
	}

}
